package com.jhwang;

import org.apache.log4j.PropertyConfigurator;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import java.util.Properties;

/**
 * 入口程序
 * @Auther: jhwang
 * @Date: 2020/4/30 16:12
 * @Description: maven 下载小工具
 */
public class MavenHttpDownloadTool {

    public static void main(String[] args) {
        initLog();
        System.out.println("程序启动。。。");
        System.out.println("读取配置文件：" + GetPropertis.CONFIG_PATH);
        //启动爬虫程序
        new GithubRepoPageProcessor(GetPropertis.DOWNLOAD_URL[0],GetPropertis.DOWNLOAD_PATH).run();
    }

    public static void initLog() {
        FileInputStream fileInputStream = null;
        try {
            Properties properties = new Properties();
            fileInputStream = new FileInputStream("src/main/resources/log4j.properties");
            properties.load(fileInputStream);
            PropertyConfigurator.configure(properties);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (fileInputStream != null) {
                try {
                    fileInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}




